def max_num(arr):
    if len(arr) == 2:
        if arr[0] > arr[1]:
            return arr[0]
        else:
            return arr[1]
    elif arr[0] > max_num(arr[1:]):
        return arr[0]
    else:
        return max_num(arr[1:])

a = [5,2,8,1,99,23,31]
print(max_num(a))